package de.wellenblau.wow3D
{
	import fr.seraf.wow.core.WOWEngine;
	import fr.seraf.wow.core.data.WVector;
	import fr.seraf.wow.primitive.WOWPlane;
	
	import org.papervision3d.core.proto.MaterialObject3D;
	import org.papervision3d.objects.primitives.Plane;
	
	public class physicPlane3D extends Plane implements physicDisplayObject3D
	{
		private var _physicObject:WOWPlane;
		
		public function physicPlane3D(x:int,y:int,z:int,size:int,mat:MaterialObject3D)
		{
			super(mat,size,size,10,10);
			
			this.x = x;
			this.y = y;
			this.z = z;
		}
		
		public function createPhysicObjet(wow:WOWEngine):void{
			_physicObject = new WOWPlane();
			wow.addParticle(_physicObject);
		}
		
		public function getPhysicObject():Object{
			return _physicObject;
		}
		
		public function syncObjects():void{
			this.x = _physicObject.px;
			this.y = _physicObject.py;
			this.z = _physicObject.pz;
			
			var tmpVector:WVector = _physicObject.getRotation();
			
			this.rotationX = tmpVector.x-90;
			this.rotationY = tmpVector.y;
			this.rotationZ = tmpVector.z;
		}

	}
}